﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class quantri_Registration : System.Web.UI.Page
{
    DataClassesDataContext db = new DataClassesDataContext();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnClear_Click(object sender, EventArgs e)
    {
        txtAccFulName.Text = "";
        txtAccUserName.Text = "";
        txtAccEmail.Text = "";
        txtAccPassword.Text = "";
    }
    protected void btnSubmitAccount_Click(object sender, EventArgs e)
    {
        try
        {
            Account acc = new Account();
            acc.Per_id = Convert.ToInt16 (ddPermission.SelectedValue);
            acc.Acc_fullname = txtAccFulName.Text;
            acc.Acc_username = txtAccUserName.Text;
            acc.Acc_password = txtAccPassword.Text;
            acc.Acc_email = txtAccEmail.Text;

            db.Accounts .InsertOnSubmit (acc); 
            db.SubmitChanges();

            Response.Write("<Script> alert('Thêm tài khoản thành công.') </Script>");
            

        }
        catch (Exception)
        {
            
            throw;
        }
    }
}
